import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { LabelVO, LabelForm, LabelQuery } from '@/api/apartment/attribute/label/types';

/**
 * 查询标签信息列表
 * @param query
 * @returns {*}
 */

export const listLabel = (query?: LabelQuery): AxiosPromise<LabelVO[]> => {
  return request({
    url: '/apartment/label/getAllList',
    method: 'post',
    data: query
  });
};

/**
 * 查询标签信息详细
 * @param id
 */
export const getLabel = (id: string | number): AxiosPromise<LabelVO> => {
  return request({
    url: '/apartment/label/' + id,
    method: 'get'
  });
};

/**
 * 新增标签信息
 * @param data
 */
export const addLabel = (data: LabelForm) => {
  return request({
    url: '/apartment/label',
    method: 'post',
    data: data
  });
};

/**
 * 修改标签信息
 * @param data
 */
export const updateLabel = (data: LabelForm) => {
  return request({
    url: '/apartment/label',
    method: 'put',
    data: data
  });
};

/**
 * 删除标签信息
 * @param id
 */
export const delLabel = (id: string | number | Array<string | number>) => {
  return request({
    url: '/apartment/label/' + id,
    method: 'delete'
  });
};
